/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.stop.risk.alarm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.stop.common.constant.enums.ParkStopModDictEnum;
import com.hopes.bizz.stop.common.constant.enums.ParkStopSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 超标报警
 *
 * @author pig
 * @date 2024-02-22 15:21:15
 */
@Data
@TableName("line_alarm_overproof")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "超标报警")
public class LineAlarmOverproofEntity extends LineAlarmEntity {

    private static final long serialVersionUID = 1L;


    /**
     * id
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 超标数据类型 1.实时数据超标 2.小时数据超标
     */
    @Schema(description = "超标数据类型 1.实时数据超标 2.小时数据超标")
    private Integer alarmDataType;

    /**
     * 运维单位
     */
    @Schema(description = "运维单位")
    private Long operationId;

    /**
     * 监控点
     */
    @Schema(description = "监控点")
    private Long monitorSiteId;

    /**
     * 报警因子
     */
    @Schema(description = "报警因子")
    private Long factorId;

    /**
     * 最大报警值
     */
    @Schema(description = "最大报警值")
    private BigDecimal maxAlarm;

    /**
     * 最小报警值
     */
    @Schema(description = "最小报警值")
    private BigDecimal minAlarm;

    /**
     * 监测值
     */
    @Schema(description = "监测值")
    private BigDecimal monitorData;

    /**
     * 超标倍数
     */
    @Schema(description = "超标倍数")
    private BigDecimal dataTime;

    /**
     * 报警类型
     */
    @Schema(description = "报警类型")
    private Integer alarmType;

    /**
     * 报警时间
     */
    @Schema(description = "报警时间")
    private Date alarmTime;

    /**
     * 接触时间
     */
    @Schema(description = "接触时间")
    private Date removeTime;

    /**
     * 持续时间
     */
    @Schema(description = "持续时间")
    private Integer durationTime;

    /**
     * 报警级别
     */
    @Schema(description = "报警级别")
    private Integer alarmLevel;

    /**
     * 报警状态
     */
    @Schema(description = "报警状态")
    private Integer alarmStatus;

    /**
     * 风向
     */
    @Schema(description = "风向")
    private String windDirection;

    /**
     * 风速
     */
    @Schema(description = "风速")
    private String windSpeed;

    /**
     * 数据维护状态 0.未修护 1.已修护
     */
    @Schema(description = "数据维护状态 0.未修护 1.已修护")
    private Integer repairStatus;

    /**
     * 维护值
     */
    @Schema(description = "维护值")
    private BigDecimal repairData;

    /**
     * 修护时间
     */
    @Schema(description = "修护时间")
    private LocalDateTime repairTime;

    /**
     * 修护方式 1.手动修护 2.自动修护
     */
    @Schema(description = "修护方式 1.手动修护 2.自动修护")
    private Integer repairType;

    /**
     * 报警内容
     */
    @Schema(description = "报警内容")
    private String alarmContent;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;


    public String getMonitorSiteIdStr() {
        return DictResolver.getItemLabelByValue(ParkStopModDictEnum.monitor_site, this.monitorSiteId);
    }

    public String getAlarmStatusStr() {
        return DictResolver.getItemLabelByValue(ParkStopSysDictEnum.alarm_status, this.alarmStatus);
    }

    public String getHandleStatusStr() {
        return DictResolver.getItemLabelByValue(ParkStopSysDictEnum.alarm_handle_status, this.getHandleStatus());
    }

    public String getHandleResultStr() {
        return DictResolver.getItemLabelByValue(ParkStopSysDictEnum.hazard_alarm_handle_result, this.getHandleResult());
    }

}
